package com.hnust.root.dao.entity.domain.forward;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

//话题页banner
@Data
@TableName("banner")
public class Banner {
    private static final long serialVersionUID = 1L;

    @TableId
    private int id;

    //图片URL
    @TableField("img_url")
    private String screenshot;

    //public:所有人可见-0
    //private:仅设置了大学可见-1
    @TableField("type")
    private int type = 0;


    //轮播图的顺序
    @TableField("position")
    private int position;

    //轮播图描述
    @TableField("description")
    private String description;

    //轮播图对应的大学
    @TableField("university")
    private String university;

    public String getType() {
        return this.type == 0 ? "public" : "private";
    }

    public void setType(int type) {
        if (!StrUtil.isEmpty(this.university)) {
            this.type = 1;
        }
    }
}
